<template>
	<view>
		<view class="big_tital">欢迎使用 实训管家</view>
		<view class="min_tital">授权微信头像、昵称</view>
		<view>
			<view class="iconfont icon-shixi icon-shixu"></view>
			<view class="buttom_text">实训管家</view>
		</view>
		<view class="login_bottom">
			<button class="bth_login" @tap="login()">
				<text class="iconfont icon-weixin weixin"></text>
				<text class="login_text">微信授权登录</text>
			</button>
		</view>
		<view class="bottom">
				<text>登录代表您已同意了</text>
				<text class="text_buttom">《用户服务协议》</text>
				<text class="text_buttom">《隐私权政策》</text>
		</view>
	</view>
	
</template>

<script>
	const {httpGet,httpPost} = require("@/utils/common.js")
	export default {
		data() {
			return {
				code:''
			}
		},
		methods: {
			login(){
				uni.getUserProfile({
					desc:"用户授权",
					success:function(userRes){
						console.log(userRes)
						uni.login({
							provider: 'weixin',
							  success: function (loginRes) {
							    console.log(loginRes);
								var data = {
									code:loginRes.code,
									encryptedData:userRes.encryptedData,
									iv:userRes.iv,
									
								}
								console.log(data)
							  }
						});
						
					},
				})
				uni.request({
					url:" /api/wx_app_login",
					data:{
						iv:this.iv,
					},
					method:'POST',
				})
			}
		}
	}
</script>

<style>
page{
	background-color: #FFFFFF;
}
.big_tital{
	font-size: 50rpx;
	margin-top: 240rpx;
	margin-left: 40rpx;
	color: rgb(16,16,16);
}
.min_tital{
	margin-left: 40rpx;
	font-size: 30rpx;
	color: rgb(144,144,144);
	margin-top: 20rpx;
}
.buttom_text{
	font-size: 52rpx;
	color: rgb(80,124,209);
	text-align: center;
	margin-top: 20rpx;
}
.icon-shixu{
	color: rgb(64,89,218);
	font-size: 190rpx;
	margin-top: 55rpx;
	/* margin-left: 260rpx; */
	text-align: center;
}
.login_bottom{
	margin-top: 85rpx;
}
.bth_login{
	width: 640rpx;
	height: 100rpx;
	background-color: rgb(61,114,246);
	border-radius: 20rpx;
	text-align: center;
}
.weixin{
	color: #FFFFFF;
	font-size: 50rpx;
	line-height: 100rpx;
}
.login_text{
	font-size: 34rpx;
	font-weight: 600rpx;
	margin-left: 15rpx;
	color: #FFFFFF;
	line-height: 100rpx;
}
.bottom{
	position: absolute;
	bottom: 160rpx;
	margin: auto;
}
.text_buttom{
	color: rgb(82,185,232);
}
</style>
